package cn.bocweb.spinning.view.dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.bocweb.spinning.R;

/**
 * Created by chenchangxing on 16/5/3.
 */
public class ShareDialog extends AlertDialog {

    OnShareListener mOnShareListener;

    public interface OnShareListener {
        public void shareTimeLine();
        public void shareFriend();
    }

    @Bind(R.id.share_wechat_friend)
    LinearLayout mShareWechatFriend;
    @Bind(R.id.share_wechat_timeline)
    LinearLayout mShareWechatTimeline;

    public ShareDialog(Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().getDecorView().setBackgroundResource(R.color.white);
        setContentView(R.layout.dialog_share);
        setTitle("分享");
        ButterKnife.bind(this);
    }

    @OnClick({R.id.share_wechat_friend, R.id.share_wechat_timeline})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.share_wechat_friend:
                mOnShareListener.shareFriend();
//                WXUtil.WXShareToFriend("http://www.chinayarn.com/app/dxt.html", getContext());
                break;
            case R.id.share_wechat_timeline:
                mOnShareListener.shareTimeLine();
//                WXUtil.WXShareToTimeline("http://www.chinayarn.com/app/dxt.html", getContext());
                break;
        }
    }

    public void setOnShareListener(OnShareListener onShareListener) {
        mOnShareListener = onShareListener;
    }
}
